Skip to content

[license] Handle missing license metadata (#227)#228

Merged
coisa merged 2 commits intomainfrom
fix/227-missing-license-metadata
Apr 24, 2026
Merged

[license] Handle missing license metadata (#227)#228
coisa merged 2 commits intomainfrom
fix/227-missing-license-metadata

Conversation

@coisa
Copy link
Copy Markdown
Contributor

@coisa coisa commented Apr 24, 2026

Related Issue

Closes #227

Motivation / Context

  • Consumers may omit the license field or leave it empty in composer.json.
  • The license generator previously passed that missing metadata into License\Resolver::resolve(), causing a TypeError before the command could skip generation cleanly.

Changes

  • Allows the license resolver contract to receive missing or empty license metadata and return null.
  • Keeps unsupported or absent license metadata on the existing skip path instead of failing.
  • Adds regression coverage for missing, null, and empty license metadata without committing another consumer project fixture.

Verification

  • composer dev-tools
  • Focused command(s):
    • ./vendor/bin/phpunit tests/License/ResolverTest.php tests/License/GeneratorTest.php tests/Console/Command/LicenseCommandTest.php
    • composer dev-tools tests -- --filter='License' --no-cache
    • composer dev-tools code-style -- --json
    • composer dev-tools refactor -- --json
    • composer dev-tools phpdoc -- --json
    • composer dev-tools changelog:check
    • git diff --check
  • Manual verification: created a temporary consumer fixture without license, ran composer install, then ran composer dev-tools license -- --dry-run --json; it skipped LICENSE generation cleanly without the previous TypeError. The temporary fixture was removed after the check.

composer dev-tools was also attempted, but this local shell still hits the existing nested process TTY failure (proc_open(/dev/tty): Failed to open stream: Device not configured) before the full gate can complete.

Documentation / Generated Output

  • README updated
  • docs/ updated
  • Generated or synchronized output reviewed

No public docs or generated output changed; this is a defensive bug fix for missing metadata.

Changelog

  • Added a notable CHANGELOG.md entry

Reviewer Notes

  • The consumer-without-license case is covered permanently by unit tests; the full fixture project was intentionally not committed because this regression does not need another fixture tree.

@github-actions
Copy link
Copy Markdown
Contributor

@coisa coisa merged commit da58692 into main Apr 24, 2026
2 checks passed
@coisa coisa deleted the fix/227-missing-license-metadata branch April 24, 2026 05:06
@github-project-automation github-project-automation Bot moved this from Backlog to Released in PHP Fast Forward Project Apr 24, 2026
github-actions Bot added a commit that referenced this pull request Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Released

Development

Successfully merging this pull request may close these issues.

[license] Handle missing composer license without TypeError

1 participant